import os
from loguru import logger
from utils.read_yaml import YAML
from configs.app_config import create_app
from utils.enums import FilePath
import eventlet.wsgi

app, socketio = create_app()
file_name = "banner.txt"
file_path = os.path.normpath(os.path.join(FilePath.PROJECT_ROOT_PATH.value, file_name))
application = YAML.ReadRoot('application')

with open(file_path, 'r', encoding='utf-8') as f:
    line = f.readline()
    while line:
        logger.info(line.strip())
        line = f.readline()

if __name__ == '__main__':
    eventlet.wsgi.server(eventlet.listen((application['host'], application['port'],)), app)
